package my.climbing;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;

public class MyungsoInfoActivity extends Activity implements View.OnClickListener{
	Button b1,b2;
	TextView tv,tv1;
	ImageView imgv;
	ScrollView sc;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.myungsoinfo);
		
		sc = (ScrollView)findViewById(R.id.scrollView1);
		b2 = (Button)findViewById(R.id.myungso_close_btn);
		b2.setOnClickListener(this);
		tv = (TextView)findViewById(R.id.myungso_name);
		tv1= (TextView)findViewById(R.id.myungso_info_txt);
		imgv=(ImageView)findViewById(R.id.myungso_img);
		
		Intent i = getIntent();
		String myungso_name = i.getStringExtra("myungso_name");
		String myungso_img = i.getStringExtra("myungso_img");
		String myungso_info= i.getStringExtra("myungso_info");
		tv.setText(myungso_name);
		tv1.setText(myungso_info);

		try {
			String strUrl = "http://211.238.142.88:8080/MapPointProject/myungso/image/";
			URL url = new URL(strUrl+myungso_img);
			HttpURLConnection conn = (HttpURLConnection) url.openConnection();
			if (conn != null) {
				InputStream is = conn.getInputStream();
				BufferedInputStream bi = new BufferedInputStream(is);
				Bitmap bm = BitmapFactory.decodeStream(bi);
				is.close();
				bi.close();

				imgv.setImageBitmap(bm);
			}
		} catch (Exception e) {
		}
	}
	
	public void onClick(View v) {
		if(v.getId()==R.id.myungso_close_btn){
			finish();
		}
	}
}
